@extends('layouts.admin')
@section('css')
<link href="{{ asset('admin/assets/font-awesome/css/font-awesome.css') }}" rel="stylesheet" />
<link href="{{ asset('admin/assets/advanced-datatable/media/css/demo_page.css') }}" rel="stylesheet" />
<link href="{{ asset('admin/assets/advanced-datatable/media/css/demo_table.css') }}" rel="stylesheet" />
@endsection
@section('content')
      <section id="main-content">
          <section class="wrapper">
              <!-- page start-->
              <div class="row">
                  <div class="col-lg-12">
                      <section class="panel">
                          <header class="panel-heading">
                              {{ $user->name }}({{ $user->mobile }})下级列表
                          </header>
                          <div class="panel-body">
                                <div class="adv-table">
                                    <table  class="display table table-bordered table-striped" id="subs">
                                      <thead>
                                      <tr>
                                          <th>用户名</th>
                                          <th>手机</th>
                                          <th>上级</th>
                                          <th>余额</th>
                                          <th>冻结</th>
                                          <!-- <th>所属角色</th> -->
                                          <th>创建时间</th>
                                      </tr>
                                      </thead>
                                      <tbody>
                                      @foreach($subs as $user)
                              <tr>
                                  
                                  <td>{{ $user->name }}</td>
                                  <td>{{ $user->mobile }}</td>
                                  <td>
                                    @inject('userPresenter','App\Presenters\UserPresenter')

                                    {!! $userPresenter->parent($user->parent_id) !!}
                                    </td>
                                  <td>{{ $user->balance }}</td>
                                  <td>{{ $user->frozen_funds }}</td>
                                  <!-- <td>
                                      @if($user->roles()->count())
                                          @foreach($user->roles()->get() as $role)
                                              <span class="label label-primary">{{ $role->name }}</span>
                                          @endforeach
                                      @else
                                          <span class="label label-default">无</span>
                                      @endif
                                  </td> -->
                                  <td>{{ $user->created_at }}</td>
                                  
                              </tr>
                          @endforeach
                                      
                                      
                                      </tbody>
                                      <tfoot>
                                      <tr>
                                          <th>用户名</th>
                                          <th>手机</th>
                                          <th>上级</th>
                                          <th>余额</th>
                                          <th>冻结</th>
                                          <!-- <th>所属角色</th> -->
                                          <th>创建时间</th>
                                      </tr>
                                      </tfoot>
                          </table>
                                </div>
                          </div>
                      </section>
                  </div>
              </div>
              <!-- page end-->
          </section>
      </section>
@endsection
@section('javascript')
  
<script type="text/javascript" language="javascript" src="{{ asset('admin/assets/advanced-datatable/media/js/jquery.dataTables.js') }}"></script>
 <script type="text/javascript" charset="utf-8">
      $(document).ready(function() {
          $('#subs').dataTable( {
              "aaSorting": [[ 6, "desc" ]],
              "oLanguage": {
                   "oPaginate": {
                     "sLast": "最后一页",
                     "sNext":"下页",
                     "sPrevious":"上页",
                     "sEmptyTable":"没有相关数据",
                   },
                   "sInfo": " _START_ - _END_ / _TOTAL_ 条记录",
                   "sLengthMenu": "显示 _MENU_ 条记录",
                   "sSearch": "搜索:",
                 }
          } );
      } );
  </script>
@endsection

